package com.data.springbootdynamicdata.datasource;

/***
 *  Author:  wenlin
 *  Date:  2018/4/23
 *  Description:设置指定数据源存在threadlocal
 **/
public class DataSourceContextHolder {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();

    public static synchronized void setDBType(String dbType){
        contextHolder.set(dbType);
    }

    public static String getDBType(){
        return contextHolder.get();
    }

    public static void clearDBType(){
        contextHolder.remove();
    }
}
